Refine Sentry initialization to only track production errors #628
+10
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves Sentry error tracking configuration to ensure errors are only reported from production environments, preventing noise from local development and preview deployments.
Changes
includes("boardsesh.com")to exact match=== "boardsesh.com"to prevent false positives from subdomainsNODE_ENV === "production"check alongsideVERCEL_ENV === "production"to ensure both conditions are met before initializing SentryNODE_ENV === "production"check alongsideVERCEL_ENV === "production"to ensure both conditions are met before initializing SentryImplementation Details
The changes enforce stricter production environment detection across all three Sentry configuration entry points:
NODE_ENVandVERCEL_ENVto be set to "production", providing defense-in-depth against accidental error reporting from non-production environmentsThis prevents error pollution in Sentry from localhost development, preview deployments, and other non-production environments.
https://claude.ai/code/session_013jBTzFjbJQFyfsDM5pT4t1